﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using SvD_Templates;

namespace WindowsFormsApplication1
{
    public partial class extraTemplate : Form
    {
        #region Borderless Window
        protected override void WndProc(ref Message m)
        {
            // Let the base class have first crack
            base.WndProc(ref m);
            int WM_NCHITTEST = 0x84; // winuser.h
            // If the user clicked on the client area,
            // ask the OS to treat it as a click on the caption
            if (m.Msg != WM_NCHITTEST) return;
            int HTCLIENT = 1;
            int HTCAPTION = 2;
            if (m.Result.ToInt32() == HTCLIENT)
                m.Result = (IntPtr)HTCAPTION;
        }
        #endregion

        #region Function Keys
        protected override bool ProcessDialogKey(Keys keyData)
        {
            switch (keyData)
            {
                case Keys.Escape:
                    _dt.infoExtra = cajaTemplateExtra.Text;
                    this.Close();
                    break;
            }

            return base.ProcessDialogKey(keyData);
        }
        #endregion

        public datosTemplate _dt;

        public extraTemplate()
        {
            InitializeComponent();
        }

        private void mainTemplate_Load(object sender, EventArgs e)
        {
            cajaTemplateExtra.Text = _dt.infoExtra;
        }
    }
}
